package android.dj.lbscamera.widgets;

import java.util.ArrayList;

import android.content.Context;
import android.dj.lbscamera.R;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class GalleryAdapter extends BaseAdapter {

	private Context mContext;
	private ArrayList<Integer> imgList = new ArrayList<Integer>();
	private ArrayList<String> textList = new ArrayList<String>();
	private LayoutInflater mInflater;

	public GalleryAdapter(Context c, ArrayList<Integer> img,
			ArrayList<String> text) {
		mContext = c;
		mInflater = LayoutInflater.from(mContext);
		imgList = img;
		textList = text;
	}

	public int getCount() {
		// TODO Auto-generated method stub
		return imgList.size();
	}

	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return getView(position, null, null);
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		convertView = mInflater.inflate(R.layout.galleryadapter, null);
		((ImageView) convertView.findViewById(R.id.img))
				.setBackgroundResource(imgList.get(position));
		((TextView) convertView.findViewById(R.id.text)).setText(textList
				.get(position));
		return convertView;
	}

}
